package com.lx.oms.controller.service.impl;

import java.math.BigInteger;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.lx.oms.common.entity.Page;
import com.lx.oms.common.entity.Query;
import com.lx.oms.common.entity.R;
import com.lx.oms.common.utils.CommonUtils;
import com.lx.oms.controller.entity.UserPersonalEntity;
import com.lx.oms.controller.manager.UserPersonalManager;
import com.lx.oms.controller.service.UserPersonalService;

/**
 * 个人
 *
 * @author houzhong
 * @date 2018年7月10日 下午3:10:22
 */
@Service("userPersonalService")
public class UserPersonalServiceImpl implements UserPersonalService {

	@Autowired
	private UserPersonalManager userPersonalManager;

	@Override
	public Page<UserPersonalEntity> listUserPersonal(Map<String, Object> params) {
		Query query = new Query(params);
		Page<UserPersonalEntity> page = new Page<>(query);
		userPersonalManager.listUserPersonal(page, query);
		return page;
	}

	@Override
	public R saveUserPersonal(UserPersonalEntity role) {
		int count = userPersonalManager.saveUserPersonal(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getUserPersonalById(BigInteger id) {
		UserPersonalEntity tUserPersonal = userPersonalManager.getUserPersonalById(id);
		return CommonUtils.msg(tUserPersonal);
	}

	@Override
	public R updateUserPersonal(UserPersonalEntity userPersonal) {
		int count = userPersonalManager.updateUserPersonal(userPersonal);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(String[] id) {
		int count = userPersonalManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
